package Demo;

import java.util.Scanner;


public class Demo9 {
    static class Counter{
        public int count = 0;
    }
    public static void main(String[] args) {
        Counter counter = new Counter();

        Thread t1 = new Thread(()->{
            while(counter.count == 0){
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("t1 执行结束!");
        });
        t1.start();

        Thread t2 = new Thread(()->{
            Scanner scanner = new Scanner(System.in);
            System.out.print("> ");
            counter.count = scanner.nextInt();
        });
        t2.start();
    }
}
